# 定义函数
def stu_info(name, age, gender="男"):
    print(f"{name}的年龄是：{age}, 性别是: {gender}")

stu_info("张三", 18)  # 将姓名和年龄作为两个单独的参数


# 应用场景
def func(*args):
    print(args)

# 案例
# 需求
# 定义函数

def sum_numbers(*args):
    result = 0
    for i in args:
        print(i)
        result += i
    return f"累加的结果是:{result}"  # 修正：使用return而不是result，并且要在循环外面

# 调用函数
aa = sum_numbers(1,2,3,4,5,6)
print(aa)


# 元组拆包
def sun_numbers(*args):
    result = 0
    for i in args:
        result += i  # result = result + i
        return result

num =(1,2,3,4,5,6)
print(sun_numbers(*num))
